package com.wenjiang.controller;


import com.wenjiang.common.lang.Result;
import com.wenjiang.service.MallGoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lwj
 * @since 2021-07-20
 */
@RestController
@RequestMapping("/mallGood")
public class MallGoodController {
    @Autowired
    MallGoodService mallGoodService;


    //获取最新上架的商品

    @RequestMapping("/newGoods")
    public Object getNewGoods(){
        Result newGood = mallGoodService.getNewGood();
        return newGood;
    }


    //获取热卖商品
    @RequestMapping("/hotGoods")
    public Object getHostGoods(){
         Result hotGood= mallGoodService.getHotGood();
         return hotGood;
    }



    //获取某一个商品
    @RequestMapping("/getGoodById/{goodId}")
    public  Object getGoodById(@PathVariable(name = "goodId") Long goodId){
        return mallGoodService.getGoodById(goodId);

    }







}
